<?php

namespace Trawind\Shares\Repositories;

use Trawind\Shares\Models\Shares;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use Trawind\Shares\Validators\SharesValidator;
use Trawind\Shares\Presenters\SharesPresenter;
use Trawind\Shares\Contracts\Repositories\SharesRepository;

/**
 * Class SharesRepositoryEloquent.
 *
 * @package namespace TrawindCloud\Repositories\AccountEloquent;
 */
class SharesRepositoryEloquent extends BaseRepository implements SharesRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Shares::class;
    }

    /**
     * Specify Validator class name
     *
     * @return mixed
     */
    public function validator()
    {
        return SharesValidator::class;
    }


    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }


    public static function saveShares($class, $shares)
    {
        $class->shares()->delete();
        $class->shares()->createMany($shares);
    }


}
